package net.sahv.bdyz.util;

import java.math.BigDecimal;

public class Jiage {
	
	public static BigDecimal mianliao(Integer sizee){
		
		if(sizee<=100){// 100米以下1.3倍 
			return new BigDecimal(sizee).multiply(new BigDecimal(1.3+""));
		}
		if(sizee<=500&&sizee>100){// 100米以下1.3倍     101~500米1.15倍 
			BigDecimal yibai = new BigDecimal(100+"");
			BigDecimal yidiansan = new BigDecimal(1.3+"");
			BigDecimal yidianyiwu = new BigDecimal(1.15+"");
			BigDecimal sizea = new BigDecimal(sizee+"");
			
			
			BigDecimal yibaiCyidiansan = yibai.multiply(yidiansan);
			BigDecimal sizeaJyibai = sizea.subtract(yibai);
			BigDecimal Cyidianyiwu = sizeaJyibai.multiply(yidianyiwu);
			BigDecimal heji = yibaiCyidiansan.add(Cyidianyiwu);
			
			return heji;
		}
		if(sizee>500){// 100米以下1.3倍     101~500米1.15倍    500米以上1倍
			
			BigDecimal yibai = new BigDecimal(100+"");
			BigDecimal yidiansan = new BigDecimal(1.3+"");
			BigDecimal sibai = new BigDecimal(400+"");
			BigDecimal yidianyiwu = new BigDecimal(1.15+"");
			BigDecimal sizea = new BigDecimal(sizee+"");
			BigDecimal wubai = new BigDecimal(500+"");
			
			BigDecimal yibaiCyidiansan = yibai.multiply(yidiansan);
			BigDecimal sibaiCyidianyiwu = sibai.multiply(yidianyiwu);
			BigDecimal sizeaJwubai = sizea.subtract(wubai);
			BigDecimal heji = yibaiCyidiansan.add(sibaiCyidianyiwu).add(sizeaJwubai);
			
			
			
			return heji;
		}
		return null;
	
		
	}
	
	public static BigDecimal yinhua(Integer sizee){
		
		if(sizee<=50){// 50米以下2倍
			return new BigDecimal(sizee+"").multiply(new BigDecimal(2+""));
		}
		if(sizee>50&&sizee<=300){//50米以下2倍     51~300米1.5倍
			BigDecimal er = new BigDecimal(2+"");
			BigDecimal wushi = new BigDecimal(50+"");
			BigDecimal yidianwu = new BigDecimal(1.5+"");
			BigDecimal sizea = new BigDecimal(sizee+"");
			
			BigDecimal erCwushi = er.multiply(wushi);
			BigDecimal Jwushi = sizea.subtract(wushi);
			BigDecimal JwushiCyidianwu = Jwushi.multiply(yidianwu);
			BigDecimal heji = erCwushi.add(JwushiCyidianwu);
			return heji;
		}
		if(sizee<=1000&&sizee>300){//2*50+250*1.5+(sizee-300)*1.2
			BigDecimal er = new BigDecimal(2+"");
			BigDecimal wushi = new BigDecimal(50+"");
			BigDecimal erbaiwu = new BigDecimal(250+"");
			BigDecimal yidianwu = new BigDecimal(1.5+"");
			BigDecimal sizea = new BigDecimal(sizee+"");
			BigDecimal sanbai = new BigDecimal(300+"");
			BigDecimal yidianer = new BigDecimal(1.2+"");
			
			BigDecimal erCwushi = er.multiply(wushi);
			BigDecimal erbaiwuCyidianwu = erbaiwu.multiply(yidianwu);
			BigDecimal Jsanbai = sizea.subtract(sanbai);
			BigDecimal JsanbaiCyidianer = Jsanbai.multiply(yidianer);
			BigDecimal heji = erCwushi.add(erbaiwuCyidianwu).add(JsanbaiCyidianer);
			return heji;
		}
		if(sizee>1000){//2*50+250*1.5+700*1.2+(sizee-1000)*1
			BigDecimal er = new BigDecimal(2+"");
			BigDecimal wushi = new BigDecimal(50+"");
			BigDecimal erbaiwu = new BigDecimal(250+"");
			BigDecimal yidianwu = new BigDecimal(1.5+"");
			BigDecimal qibai = new BigDecimal(700+"");
			BigDecimal yidianer = new BigDecimal(1.2+"");
			BigDecimal sizea = new BigDecimal(sizee+"");
			BigDecimal yiqian = new BigDecimal(1000+"");
			
			BigDecimal erCwushi = er.multiply(wushi);
			BigDecimal erbaiwuCyidianwu = erbaiwu.multiply(yidianwu);
			BigDecimal qibaiCyidianer = qibai.multiply(yidianer);
			BigDecimal Jyiqian = sizea.subtract(yiqian);
			
			BigDecimal heji = erCwushi.add(erbaiwuCyidianwu).add(qibaiCyidianer).add(Jyiqian);
			return heji;
		}
		
		return null;
		
	}
	
	
}
